package com.qfedu.openplateform.manager.service.impl;

import com.qfedu.openplateform.manager.dao.CustomerMapper;
import com.qfedu.openplateform.manager.entity.Customer;
import com.qfedu.openplateform.manager.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author: wmh
 * @Date:2021/12/2 19:33
 */
@Service
@Transactional
public class CustomerServiceImpl implements CustomerService {

    @Autowired
    private CustomerMapper customerMapper;

    @Override
    public List<Customer> getAllCustomer() {
        List<Customer> customers = customerMapper.getAllCustomer();
        return customers;
    }



    @Override
    public void addCustomer(Customer customer) {
        customerMapper.addCustomer(customer);

    }

    @Override
    public void updateCustomer(Customer customer) {
        customerMapper.updateCustomer(customer);
    }

    @Override
    public void deleteCustomer(Integer[] ids) {
        for (Integer id : ids) {
            customerMapper.deleteCustomer(id);
        }

    }

    @Override
    public List<Customer> treeCustomer() {


        return customerMapper.treeCustomer();
    }
}
